/**
 * Supabase Management API 统一入口
 */

// 导出请求实例和类型
export { request, type ApiResponse, type ApiError, type RequestConfig, type RequestParamValue, type RequestData } from "./request";

// 导出各模块 API
export * as organizationsApi from "./modules/organizations";
export * as projectsApi from "./modules/projects";
export * as authApi from "./modules/auth";
export * as storageApi from "./modules/storage";
export * as databaseApi from "./modules/database";
export * as functionsApi from "./modules/functions";
export * as restApi from "./modules/rest";
export * as advisorsApi from "./modules/advisors";
export * as analyticsApi from "./modules/analytics";
export * as billingApi from "./modules/billing";
export * as domainsApi from "./modules/domains";
export * as environmentsApi from "./modules/environments";
export * as oauthApi from "./modules/oauth";
export * as realtimeApi from "./modules/realtime";
export * as secretsApi from "./modules/secrets";

// 导出各模块类型
export type {
	Organization,
	OrganizationDetail,
	OrganizationMember,
	CreateOrganizationBody,
	ProjectClaimPreview
} from "./modules/organizations";

export type {
	Project,
	ProjectStatus,
	ProjectDatabase,
	CreateProjectBody,
	SmartGroupRegion,
	SpecificRegion,
	RegionsInfo,
	NetworkBanAddressItem,
	NetworkBan,
	NetworkBanEnriched,
	NetworkCidrConfig,
	NetworkRestrictions,
	UpdateNetworkRestrictionsBody,
	RemoveNetworkBanBody,
	HealthServiceName,
	HealthStatus,
	ServiceInfo,
	ServiceHealthItem
} from "./modules/projects";

export type {
	SigningKey,
	SigningKeyAlgorithm,
	SigningKeyStatus,
	SigningKeysResponse,
	CreateSigningKeyBody,
	UpdateSigningKeyBody,
	AuthConfigResponse,
	UpdateAuthConfigBody,
	SmsProvider,
	CaptchaProvider,
	PasswordRequiredCharacters
} from "./modules/auth";

export type {
	StorageConfig,
	StorageFeatures,
	StorageCapabilities,
	StorageExternal,
	StorageBucket,
	UpdateStorageConfigBody
} from "./modules/storage";

export type {
	Snippet,
	SnippetList,
	SnippetListItem,
	SnippetContent,
	SnippetVisibility,
	SslEnforcementConfig,
	SslEnforcementResponse,
	SslEnforcementRequest,
	TypescriptResponse,
	ReadOnlyStatus,
	SetUpReadReplicaBody,
	RemoveReadReplicaBody
} from "./modules/database";

export type {
	EdgeFunction,
	FunctionStatus,
	CreateFunctionBody,
	UpdateFunctionBody,
	BulkUpdateFunctionItem,
	BulkUpdateFunctionResponse,
	DeployFunctionResponse
} from "./modules/functions";

export type {
	PostgrestConfig,
	PostgrestConfigWithJWTSecret,
	UpdatePostgrestConfigBody
} from "./modules/rest";

export type {
	LintName,
	LintLevel,
	LintType,
	Lint,
	LintMetadata,
	ProjectAdvisorsResponse
} from "./modules/advisors";

export type {
	AnalyticsInterval,
	FunctionStatsInterval,
	AnalyticsResponse,
	ApiCountItem,
	UsageApiCountResponse,
	ApiRequestsCountItem,
	UsageApiRequestsCountResponse
} from "./modules/analytics";

export type {
	AddonType,
	AddonVariant,
	ComputeInstanceVariant,
	SelectedAddon,
	AvailableAddon,
	ListProjectAddonsResponse,
	ApplyProjectAddonBody
} from "./modules/billing";

export type {
	CustomHostnameStatus,
	CustomHostnameResponse,
	VanitySubdomainStatus,
	VanitySubdomainConfigResponse,
	SubdomainAvailabilityResponse
} from "./modules/domains";

export type {
	BranchStatus,
	PreviewProjectStatus,
	BranchResponse,
	BranchDetailResponse,
	CreateBranchBody,
	UpdateBranchBody,
	ActionRunResponse
} from "./modules/environments";

export type {
	OAuthResponseType,
	GrantType,
	OAuthTokenResponse,
	OAuthAuthorizeParams,
	OAuthTokenBody,
	OAuthRevokeTokenBody
} from "./modules/oauth";

export type {
	RealtimeConfigResponse,
	UpdateRealtimeConfigBody
} from "./modules/realtime";

export type {
	ApiKeyType,
	ApiKeyResponse,
	CreateApiKeyBody,
	UpdateApiKeyBody,
	SecretResponse,
	CreateSecretItem,
	PgsodiumConfigResponse
} from "./modules/secrets";

// 默认导出所有 API
import { request } from "./request";
import organizationsApi from "./modules/organizations";
import projectsApi from "./modules/projects";
import authApi from "./modules/auth";
import storageApi from "./modules/storage";
import databaseApi from "./modules/database";
import functionsApi from "./modules/functions";
import restApi from "./modules/rest";
import advisorsApi from "./modules/advisors";
import analyticsApi from "./modules/analytics";
import billingApi from "./modules/billing";
import domainsApi from "./modules/domains";
import environmentsApi from "./modules/environments";
import oauthApi from "./modules/oauth";
import realtimeApi from "./modules/realtime";
import secretsApi from "./modules/secrets";

export default {
	request,
	organizations: organizationsApi,
	projects: projectsApi,
	auth: authApi,
	storage: storageApi,
	database: databaseApi,
	functions: functionsApi,
	rest: restApi,
	advisors: advisorsApi,
	analytics: analyticsApi,
	billing: billingApi,
	domains: domainsApi,
	environments: environmentsApi,
	oauth: oauthApi,
	realtime: realtimeApi,
	secrets: secretsApi
};
